
package com.project.projectA.core.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

/**
 * 统一定义id的entity基类.
 * @author wuwei
 *
 */
@MappedSuperclass
public abstract class BaseEntity implements Serializable {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 45586345374901436L;

	/** The id. */
	protected Long id;//实体主键

	/** The version. */
	protected Long version;//实体版本

	/** The create time. */
	protected Date createTime;//创建时间

	/** The create by. */
	protected String createBy;//创建人

	/** The last modify time. */
	protected Date lastModifyTime;//最后修改时间

	/** The last modify by. */
	protected String lastModifyBy;//最后修改人

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	@Id
	@GeneratedValue(generator = "SEQ_STORE", strategy = GenerationType.SEQUENCE)
	public Long getId() {
		return id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * Gets the version.
	 *
	 * @return the version
	 */
	@Version
	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the version.
	 *
	 * @param version the new version
	 */
	public void setVersion(Long version) {
		this.version = version;
	}

	/**
	 * Gets the creates the time.
	 *
	 * @return the creates the time
	 */
	@Column(updatable = false)
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * Sets the creates the time.
	 *
	 * @param createTime the new creates the time
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * Gets the creates the by.
	 *
	 * @return the creates the by
	 */
	@Column(updatable = false)
	public String getCreateBy() {
		return createBy;
	}

	/**
	 * Sets the creates the by.
	 *
	 * @param createBy the new creates the by
	 */
	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	/**
	 * Gets the last modify time.
	 *
	 * @return the last modify time
	 */
	@Column(insertable = false)
	public Date getLastModifyTime() {
		return lastModifyTime;
	}

	/**
	 * Sets the last modify time.
	 *
	 * @param lastModifyTime the new last modify time
	 */
	public void setLastModifyTime(Date lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

	/**
	 * Gets the last modify by.
	 *
	 * @return the last modify by
	 */
	@Column(insertable = false)
	public String getLastModifyBy() {
		return lastModifyBy;
	}

	/**
	 * Sets the last modify by.
	 *
	 * @param lastModifyBy the new last modify by
	 */
	public void setLastModifyBy(String lastModifyBy) {
		this.lastModifyBy = lastModifyBy;
	}

}
